package com.bjpowernode.springboot.web;

import com.bjpowernode.springboot.model.Student;
import com.bjpowernode.springboot.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class StudentController {

    @Autowired
    private StudentService studentService;

    @GetMapping(value = "/student")
    public Object student(Integer id){
        Student student = studentService.findStudentById(id);
        return student;
    }

    @PostMapping(value = "/studentTwo")
    public Object student2(Integer id){
        Student student = studentService.findStudentById(id);
        return student;
    }
}
